package com.freewater.springboot.demo.aop.api.advised;

import org.jetbrains.annotations.NotNull;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.lang.Nullable;

import java.lang.reflect.Method;
import java.util.Arrays;

public class SimpleBeforeAdvice implements MethodBeforeAdvice {

    public void before(Method method,
                       Object @NotNull [] args,
                       @Nullable Object target) {
        String msg = String.format("before advice, method: %s, args: %s",
                method.getName(),
                Arrays.toString(args));
        System.out.println(msg);
    }
}
